<template>
	<view class="contact">
		<image class="img" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic05.babytreeimg.com%2Ffoto3%2Fthumbs%2F2016%2F0301%2F08%2F1%2F1c034f7fdb12bd3feefeb385_mb.jpg&refer=http%3A%2F%2Fpic05.babytreeimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1651655151&t=cb0deade9dd3ed7690e8e4e62fa5f5ea" mode="widthFix"></image>
		<view class="info">
			<view @click="phone()">联系电话：17815272971(点击可拨打)</view>
			<view>联系地址：重庆市巴南区重庆工程学院</view>
		</view>
		<map v-if="true" class="map" :scale="scale" :longitude="longitude" :latitude="latitude" :markers="markers" :style="{height:h+'rpx',width:750+'rpx'}">
		</map>	
	</view>
</template>

<script>
	export default {
		data(){
			return{
				longitude:106.595401,
				latitude:29.422101,
				scale:13,
				markers:[
					{	id: 1,
						longitude:106.59540,
						latitude:29.422100,
						iconPath:'../../static/position.png',
						width:20,
						height:20
					}
				],
				h:0
			}
		},
		onLoad(){
					const sysInfo=uni.getSystemInfoSync()
						var rpx=sysInfo.screenHeight * (750 / sysInfo.windowWidth); //将px 转换rpx
						this.h=rpx-490
						this.w=sysInfo.windowWidth
			
			},
		methods:{
			phone(){
				uni.makePhoneCall({
					phoneNumber:'17815272971'.toString()
				})
			},
			handleMapLocation() {
							console.log('进入导航')
							//  经纬度暂时写死，后面介入数据
							let latitude = Number(29.422101);
							let longitude = Number(106.595401);
							let address='重庆工程学院'
							// 获取定位信息
							uni.getLocation({
								type: 'wgs84', //返回可以用于uni.openLocation的经纬度
								// 用户允许获取定位
								success: function(res) {
									console.log(res, '经纬度===>')
									if (res.errMsg == "getLocation:ok") {
										console.log(latitude)
										console.log(longitude)
										uni.openLocation({
											// 传入你要去的纬度
											latitude: latitude,
											// 传入你要去的经度
											longitude: longitude,
											// 传入你要去的地址信息 不填则为空
											address: address,
											// 缩放大小
											scale: 18,
											success: function() {
												console.log('成功的回调success');
											}
										});
									}
								},
		
							});
						}
		
		}
	}
</script>

<style lang="scss">
	.img{
		width: 750rpx;
		height: 320rpx;
	}
	.info{
		padding: 10rpx 20rpx;
		font-size:30rpx;
		view{
			line-height: 70rpx;
			border-bottom: 1px solid #eee;
		}
	}
</style>
